home *** CD-ROM | disk | FTP | other *** search
/ Disc to the Future 2 / Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin / MAC / THINKC / 4_0 / FLIGHT / OFFSCRPO.C < prev    next >
Text File  |  1990-01-26  |  1KB  |  57 lines

  1. /*
  2. #include    <MemoryMgr.h>
  3. #include <WindowMgr.h>
  4. #include    <Quickdraw.h>
  5. */
  6. #include "defines.h"
  7.  
  8. extern    WindowPtr        theWind;    /*the main window*/
  9.  
  10. BitMap    oldMap;
  11. GrafPort    offPort;
  12.  
  13.  
  14. SetBack()
  15. {
  16.     SetPort(&offPort);
  17. }
  18.  
  19. MkPort(theWindow)
  20. WindowPtr    theWindow;
  21. {
  22.     Rect    windRect;
  23.     QDPtr    newSpace;
  24.     int        rwBytes;
  25.  
  26.     windRect = theWindow->portRect;
  27.     windRect.bottom = windRect.bottom - windRect.top;
  28.     windRect.top = 0;
  29.     windRect.right = windRect.right - windRect.left;
  30.     windRect.left = 0;
  31.  
  32.     OpenPort(&offPort);
  33.     offPort.portRect = windRect;
  34.     offPort.portBits.bounds = windRect;
  35.     SetRectRgn(offPort.visRgn, 0, 0, windRect.right, windRect.bottom);
  36.     SetRectRgn(offPort.clipRgn, 0, 0, windRect.right, windRect.bottom);
  37.  
  38.     rwBytes = ((windRect.right + 15) / 16) * 2;
  39.     newSpace = NewPtr((long)rwBytes * windRect.bottom);
  40.     if (MemErr)
  41.         return;
  42.  
  43.     offPort.portBits.rowBytes = rwBytes;
  44.     offPort.portBits.baseAddr = newSpace;
  45.     SetPort(&offPort);
  46.     EraseRect(&offPort.portRect);
  47. }
  48.  
  49. GetWind(theWindow)
  50. WindowPtr    theWindow;
  51. {
  52.     CopyBits(&offPort.portBits, &theWindow->portBits,
  53.             &offPort.portRect, &theWindow->portRect,
  54.             srcCopy, 0L);
  55. }
  56. /*    rowBytes = ((width + 15) / 16) * 2;*/
  57.